package com.linghang.lhonline.service.Impl;

import com.linghang.lhonline.dataobject.Comment;
import com.linghang.lhonline.repository.CommentRepository;
import com.linghang.lhonline.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentServiceImpl implements CommentService {

    private CommentRepository commentRepository;

    @Autowired
    public CommentServiceImpl(CommentRepository commentRepository) {
        this.commentRepository = commentRepository;
    }

    @Override
    public Comment save(Comment comment) {
        return commentRepository.save(comment);
    }

    @Override
    public void delete(Comment comment) {
        commentRepository.delete(comment);
    }

    @Override
    public List<Comment> findByMissionId(Integer missionId) {
        return commentRepository.findByMissionId(missionId);
    }

    @Override
    public Comment findByCommentId(Integer commentId) {
        return commentRepository.findByCommentId(commentId);
    }

}
